Rendering content to a composition target
Use a Composition Target Render Pass to render content to a composition target.
Composition Target Render Pass automatically creates a texture from the content. You can use a Blit Render Pass to draw this texture to the screen or to another composition target using a specific material. To render content to a Render Target Texture, you can use the Render to Texture Pass. See Rendering to texture.
To render content to a composition target:
- In the Library > Rendering > Render Passes create a Group Render Pass.
Group Render Pass allows you to collect render passes so that you can refer to a single render pass in your Scene or Viewport 2D node.
- In the Group Render Pass create a Composition Target Render Pass.
Composition Target Render Pass renders itself and its child render passes to a composition target.
The Composition Target Render Pass creates a composition target of the same size as the Viewport area of the Group Render Pass.
- In the Composition Target Render Pass create the render passes that render the content that you want to use.
For example:- Create a Default Render Pass.
Default Render Pass creates a basic set of render passes that first render opaque nodes and then transparent nodes.
- In the Default Render Pass > Clear Render Pass add and set the Clear Color property.
You clear the color buffer with the color you set in the Clear Color property and set the background color of the scene.
- In the Project select the Scene node the content of which you want to render to a composition target and in the Properties set the Render Pass property to the Group Render Pass you created in the first step.
Kanzi now renders the Scene using the render passes you created. Kanzi renders the content to a composition target which is why you do not see the content in the Preview.
-
To draw the composition target to the screen with a specific material use a Blit Render Pass.
For example, in the Group Render Pass create a Blit Render Pass and in the Properties set:
- Texture0 to the Composition Target Render Pass you created in the previous step
- Material to the material you want the Blit Render Pass to use
- (Optional) If you do not set the Composition Target property, you can set these properties in the Composition Target Render Pass:
- Resolution Multiplier and Resolution Divisor to set the resolution of the default composition target.
Kanzi Studio multiplies the resolution of the composition target by the value of the Resolution Multiplier property and divides it by the value of the Resolution Divisor property.
For example, to multiply the resolution of the composition target by four set Resolution Multiplier to 4. To reduce the resolution of the composition target to a quarter of the original, set Resolution Divisor to 4.
- Pixel Format to set the pixel format of the composition target.
- Depth Texture Format to set the format of the depth composition target.
- Addressing Mode to set how Kanzi handles the texture coordinates of the composition target textures outside the [0, 0] - [1, 1] rectangle:
- Clamp to confine the texture to these coordinates and to repeat the edge texels of the texture outside of the coordinates. This is the default value.
- Repeat to make the texture repeat outside of these coordinates.
- Filter Mode to set how Kanzi accesses the texture samples of the composition target:
- Nearest to take the color from the nearest sample.
- Linear to interpolate the color from the neighboring samples. This is the default value.
- Mipmap Mode to create mipmaps for the composition target. See Creating mipmaps for a composition target.
- Multisample Level to set the number of anti-aliasing samples you want to use. See Using multisampling.
See also
Rendering
Using Kanzi Studio render pass templates
Rendering multiple render passes or textures
Creating mipmaps for a composition target
Using multisampling
Tutorial: Create a Gaussian blur effect
Tutorial: Create a bloom effect
Open topic with navigation